package com.lyl.controller;

import com.lyl.domain.SysUser;
import com.lyl.model.Result;
import com.lyl.service.SysUserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Authorization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lylbell
 * @date 2021-06-22 14:00
 */
@RestController
public class TestController {

    @Autowired
    private SysUserService sysUserService;

    @ApiOperation(value = "通过用户id查询用户信息",authorizations = @Authorization("token"))
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "用户id")
    })
    @GetMapping("/user/info/{id}")
    public Result<SysUser> getUserById(@PathVariable("id")Long id) {
        SysUser sysUser = sysUserService.getById(id);
        return Result.ok(sysUser);
    }

}
